package com.ruoyi.subject.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.subject.mapper.SubjectProgressMapper;
import com.ruoyi.subject.domain.SubjectProgress;
import com.ruoyi.subject.service.ISubjectProgressService;

/**
 * 课题进度Service业务层处理
 * 
 * @author yepanpan
 * @date 2021-03-15
 */
@Service
public class SubjectProgressServiceImpl implements ISubjectProgressService 
{
    @Autowired
    private SubjectProgressMapper subjectProgressMapper;

    /**
     * 查询课题进度
     * 
     * @param id 课题进度ID
     * @return 课题进度
     */
    @Override
    public SubjectProgress selectSubjectProgressById(Long id)
    {
        return subjectProgressMapper.selectSubjectProgressById(id);
    }

    /**
     * 查询课题进度列表
     * 
     * @param subjectProgress 课题进度
     * @return 课题进度
     */
    @Override
    public List<SubjectProgress> selectSubjectProgressList(SubjectProgress subjectProgress)
    {
        return subjectProgressMapper.selectSubjectProgressList(subjectProgress);
    }

    /**
     * 新增课题进度
     * 
     * @param subjectProgress 课题进度
     * @return 结果
     */
    @Override
    public int insertSubjectProgress(SubjectProgress subjectProgress)
    {
        subjectProgress.setCreateTime(DateUtils.getNowDate());
        subjectProgress.setCreateBy(SecurityUtils.getUsername());
        return subjectProgressMapper.insertSubjectProgress(subjectProgress);
    }

    /**
     * 修改课题进度
     * 
     * @param subjectProgress 课题进度
     * @return 结果
     */
    @Override
    public int updateSubjectProgress(SubjectProgress subjectProgress)
    {
        subjectProgress.setUpdateTime(DateUtils.getNowDate());
        subjectProgress.setUpdateBy(SecurityUtils.getUsername());
        return subjectProgressMapper.updateSubjectProgress(subjectProgress);
    }

    /**
     * 批量删除课题进度
     * 
     * @param ids 需要删除的课题进度ID
     * @return 结果
     */
    @Override
    public int deleteSubjectProgressByIds(Long[] ids)
    {
        return subjectProgressMapper.deleteSubjectProgressByIds(ids);
    }

    /**
     * 删除课题进度信息
     * 
     * @param id 课题进度ID
     * @return 结果
     */
    @Override
    public int deleteSubjectProgressById(Long id)
    {
        return subjectProgressMapper.deleteSubjectProgressById(id);
    }
}
